Skip to content

ci(workflows): 同步 dev 分支工作流 - #637

Closed
ClozyA wants to merge 2 commits into
mainfrom
codex/sync-github-from-dev
Closed

ci(workflows): 同步 dev 分支工作流#637
ClozyA wants to merge 2 commits into
mainfrom
codex/sync-github-from-dev

Conversation

@ClozyA

@ClozyA ClozyA commented Sep 9, 2026

Copy link
Copy Markdown
Member

Sourcery 总结

将 CI 工作流与基于变更日志的版本管理和贡献者署名流程同步。

新功能:

  • 添加拉取请求验证,要求更新 CHANGELOG.md,并验证从变更日志生成的版本构件是否已同步。

错误修复:

  • 更新贡献者署名自动化流程,用于比较并标注新添加的变更日志条目,同时妥善处理缺失或无效的变更日志。

改进:

  • 以变更日志作为唯一事实来源,集中处理贡献者标注和版本重新生成。
  • 将应用构建工作流升级为使用 Runtime v0.1.4。

CI:

  • 将工作流变更与开发分支同步,包括 Python 设置和变更日志一致性检查。
  • 用整合后的变更日志验证工作流替换已过时的版本 JSON 检查工作流。
Original summary in English

Sourcery 摘要

围绕 CHANGELOG.md 集中管理版本和发布元数据,并在整个 CI 和打包工作流中强制执行同步。

新功能:

  • 添加集中式变更日志管理脚本,用于验证、同步和报告项目版本及生成的发布元数据。
  • 要求拉取请求修改 CHANGELOG.md,并验证其与生成的版本构件的一致性。

错误修复:

  • 通过比较新添加的变更日志条目来生成贡献者归属信息,并安全地跳过缺失或无效的变更日志。

增强功能:

  • 使用 CHANGELOG.md 作为贡献者归属和版本生成的唯一事实来源。
  • 通过将一致性检查交由变更日志工具处理,简化本地软件包版本验证。

CI:

  • 将工作流检查与开发分支同步,并统一使用 Python 3.12 环境。
  • 使用整合后的变更日志和生成构件验证,替换已废弃的版本 JSON 验证工作流。
  • 将应用构建升级到 Runtime v0.1.4。
Original summary in English

Summary by Sourcery

Centralize version and release metadata management around CHANGELOG.md and enforce its synchronization throughout CI and packaging workflows.

New Features:

  • Add a centralized changelog management script to validate, synchronize, and report project versions and generated release metadata.
  • Require pull requests to modify CHANGELOG.md and verify its consistency with generated version artifacts.

Bug Fixes:

  • Make contributor attribution compare newly added changelog entries and safely skip missing or invalid changelogs.

Enhancements:

  • Use CHANGELOG.md as the single source of truth for contributor attribution and version generation.
  • Simplify local package version validation by delegating consistency checks to the changelog tooling.

CI:

  • Synchronize workflow checks with the development branch and standardize their Python 3.12 setup.
  • Replace the obsolete version JSON validation workflow with consolidated changelog and generated-artifact validation.
  • Upgrade application builds to Runtime v0.1.4.

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

审查者指南

本 PR 将 CI 的版本与更新日志管理切换为以 CHANGELOG.md 为唯一手写来源:贡献者署名通过共享解析器精确修改日志并重新生成版本信息,同时新增 PR 级别的一致性与必改文件检查,升级构建 Runtime 版本并移除旧版 JSON 校验工作流。

CHANGELOG 贡献者署名时序图

sequenceDiagram
    participant PR as Pull Request
    participant Workflow as append-version-contributor
    participant Parser as scripts/changelog.py
    participant Changelog as CHANGELOG.md
    participant Generated as Generated version files

    Workflow->>Parser: parse_changelog(content)
    Parser-->>Workflow: base and head entries
    Workflow->>Workflow: Compare (version, category, item)
    Workflow->>Parser: parse_changelog(CHANGELOG_PATH)
    Parser-->>Workflow: current entries and dates
    Workflow->>Changelog: write_text(CHANGELOG_PATH, render_changelog(...))
    Workflow->>Parser: changelog.py sync
    Parser->>Generated: Regenerate version information
    Workflow->>Generated: git add generated files
    Workflow-->>PR: Commit and push contributor attribution
Loading

PR 更新日志校验流程图

flowchart TD
    PR[Pull request opened or updated] --> Checkout[Checkout repository]
    Checkout --> Setup[Set up Python 3.12]
    Setup --> Check[python scripts/changelog.py check]
    Check --> Files[Check PR file list]
    Files --> Required{CHANGELOG.md changed?}
    Required -->|Yes| Pass[Validation passes]
    Required -->|No| Fail[Fail the PR check]
Loading

文件级变更

变更 详情 文件
将贡献者署名流程从直接修改版本 JSON 改为解析、更新并重新渲染 CHANGELOG.md,再同步生成版本信息。
  • 新增 Python 3.12 环境并复用 changelog 脚本解析逻辑。
  • 按版本、分类和原文精确识别 PR 新增条目,向匹配条目追加作者署名。
  • 对缺失或格式错误的基准/分支 CHANGELOG 容错跳过,并在变更后执行版本信息同步。
  • 提交时纳入 CHANGELOG.md 及其生成的版本和锁定文件。
.github/workflows/append-version-contributor.yml
升级应用构建所使用的 Runtime 版本。
  • 将 RUNTIME_VERSION 从 v0.1.3 更新为 v0.1.4。
.github/workflows/build-app.yml
新增 PR 更新日志与生成物一致性检查。
  • 在 PR 事件中运行 changelog check,校验格式、版本号和生成物是否同步。
  • 要求每个 PR 的文件列表包含 CHANGELOG.md。
.github/workflows/check-changelog.yml
移除旧的版本 JSON 检查工作流。
  • 删除原有 check-version-json 工作流。
.github/workflows/check-version-json.yml

可能关联的问题


提示和命令

与 Sourcery 交互

  • 触发新的审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以使用 @sourcery-ai issue 回复审查评论,以从中创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title,以随时重新生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中你希望插入摘要的位置写入 @sourcery-ai summary,即可随时生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary,以随时重新生成摘要。
  • 生成审查者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时重新生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会非常有用。
  • 忽略所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你希望使用新的审查重新开始,这尤其有用——别忘了评论 @sourcery-ai review 以触发新的审查!

自定义你的使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

本 PR 将 CI 的版本与更新日志管理切换为以 CHANGELOG.md 为唯一手写来源:贡献者署名通过共享解析器精确修改日志并重新生成版本信息,同时新增 PR 级别的一致性与必改文件检查,升级构建 Runtime 版本并移除旧版 JSON 校验工作流。

Sequence diagram for CHANGELOG contribution attribution

sequenceDiagram
    participant PR as Pull Request
    participant Workflow as append-version-contributor
    participant Parser as scripts/changelog.py
    participant Changelog as CHANGELOG.md
    participant Generated as Generated version files

    Workflow->>Parser: parse_changelog(content)
    Parser-->>Workflow: base and head entries
    Workflow->>Workflow: Compare (version, category, item)
    Workflow->>Parser: parse_changelog(CHANGELOG_PATH)
    Parser-->>Workflow: current entries and dates
    Workflow->>Changelog: write_text(CHANGELOG_PATH, render_changelog(...))
    Workflow->>Parser: changelog.py sync
    Parser->>Generated: Regenerate version information
    Workflow->>Generated: git add generated files
    Workflow-->>PR: Commit and push contributor attribution
Loading

Flow diagram for PR changelog validation

flowchart TD
    PR[Pull request opened or updated] --> Checkout[Checkout repository]
    Checkout --> Setup[Set up Python 3.12]
    Setup --> Check[python scripts/changelog.py check]
    Check --> Files[Check PR file list]
    Files --> Required{CHANGELOG.md changed?}
    Required -->|Yes| Pass[Validation passes]
    Required -->|No| Fail[Fail the PR check]
Loading

File-Level Changes

Change Details Files
将贡献者署名流程从直接修改版本 JSON 改为解析、更新并重新渲染 CHANGELOG.md,再同步生成版本信息。
  • 新增 Python 3.12 环境并复用 changelog 脚本解析逻辑。
  • 按版本、分类和原文精确识别 PR 新增条目,向匹配条目追加作者署名。
  • 对缺失或格式错误的基准/分支 CHANGELOG 容错跳过,并在变更后执行版本信息同步。
  • 提交时纳入 CHANGELOG.md 及其生成的版本和锁定文件。
.github/workflows/append-version-contributor.yml
升级应用构建所使用的 Runtime 版本。
  • 将 RUNTIME_VERSION 从 v0.1.3 更新为 v0.1.4。
.github/workflows/build-app.yml
新增 PR 更新日志与生成物一致性检查。
  • 在 PR 事件中运行 changelog check,校验格式、版本号和生成物是否同步。
  • 要求每个 PR 的文件列表包含 CHANGELOG.md。
.github/workflows/check-changelog.yml
移除旧的版本 JSON 检查工作流。
  • 删除原有 check-version-json 工作流。
.github/workflows/check-version-json.yml

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

您好——我发现了 1 个问题

提供给 AI Agent 的提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path=".github/workflows/check-changelog.yml" line_range="48" />
<code_context>
+      # CHANGELOG.md 是唯一手写来源,res/version.json 与四处版本号都由它生成。
+      # 这一步同时校验更新日志格式、五处版本号一致、生成物是最新的。
+      - name: 检查更新日志格式与版本号一致性
+        run: python scripts/changelog.py check
+
+      - name: 检查 PR 文件列表
</code_context>
<issue_to_address>
**问题 (bug_risk):** 两个工作流都会调用或导入更新日志实现,但仓库中缺少 `scripts/changelog.py`,因此 PR 检查会因找不到文件而失败,合并后的贡献者任务也会在执行任何工作前因 `ModuleNotFoundError` 而失败。

**建议修复:** 添加 `scripts/changelog.py`(以及其导出的 `parse_changelog``render_changelog``read_text``write_text``CHANGELOG_PATH` API),或者更新两个工作流,使其引用实际的更新日志实现路径。
</issue_to_address>

Sourcery 评估

需要人工审核。 有 1 个问题需要优先处理;如果更新日志解析器或生成版本同步存在错误,机器人可能会写入并推送错误的 CHANGELOG.md 和版本元数据,而运行时版本变更也可能影响构建产物。恢复工作流不会移除已经生成的提交或产物,但由此产生的变更范围有限,可以修复或重新生成。

阻塞性问题:.github/workflows/check-changelog.yml:48


Sourcery 对开源项目免费——如果您喜欢我们的审核结果,请考虑分享给他人 ✨
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/check-changelog.yml" line_range="48" />
<code_context>
+      # CHANGELOG.md 是唯一手写来源,res/version.json 与四处版本号都由它生成。
+      # 这一步同时校验更新日志格式、五处版本号一致、生成物是最新的。
+      - name: 检查更新日志格式与版本号一致性
+        run: python scripts/changelog.py check
+
+      - name: 检查 PR 文件列表
</code_context>
<issue_to_address>
**issue (bug_risk):** Both workflows invoke or import the changelog implementation, but `scripts/changelog.py` is absent from the repository, so the PR check fails with a file-not-found error and the post-merge contributor job fails with `ModuleNotFoundError` before performing any work.

**Suggested fix:** Add `scripts/changelog.py` (and its exported `parse_changelog`, `render_changelog`, `read_text`, `write_text`, and `CHANGELOG_PATH` APIs), or update both workflows to reference the actual changelog implementation path.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if the changelog parser or generated-version sync is wrong, the bot can write and push incorrect CHANGELOG.md and version metadata, and the runtime-version change can affect built packages. Reverting the workflow will not remove commits or artifacts already produced, but the resulting changes are bounded and can be repaired or regenerated.

Blocking findings: .github/workflows/check-changelog.yml:48


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/check-changelog.yml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5697d9c1e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# CHANGELOG.md 是唯一手写来源,res/version.json 与四处版本号都由它生成。
# 这一步同时校验更新日志格式、五处版本号一致、生成物是最新的。
- name: 检查更新日志格式与版本号一致性
run: python scripts/changelog.py check

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the changelog tool before invoking it

For every opened or synchronized PR, this step checks out the reviewed tree and immediately runs a file that is not present: a repo-wide search of this commit finds neither scripts/changelog.py nor any changelog.py. The command therefore exits with [Errno 2] before performing any validation, making this required check fail for every PR; the same missing module also breaks the updated contributor workflow's import changelog and later sync invocation after merges.

Useful? React with 👍 / 👎.

Comment on lines +65 to +67
except subprocess.CalledProcessError:
print(f"{ref} 上没有 CHANGELOG.md,跳过对比")
return {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop attribution when the base changelog cannot be loaded

When a merged PR's base commit has no CHANGELOG.md or its file cannot be parsed—as will happen for the first migration PR based on this commit, whose tree has no such file—returning {} does not skip the comparison. It makes every entry in the PR head appear newly added, so the later loop appends that PR author's suffix to every matching unsuffixed historical entry in the current changelog, corrupting contributor attribution; this path should terminate without making attribution changes instead.

Useful? React with 👍 / 👎.

Comment on lines +61 to +62
if (!files.some(file => file.filename === 'CHANGELOG.md')) {
core.setFailed('每个 PR 都必须包含对 CHANGELOG.md 的更改。');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align contributor instructions with the new changelog source

Once the missing tooling is supplied, this check makes CHANGELOG.md the required hand-edited file and rejects PRs that omit it, but the repository's mandatory engineering guidance still directs agents to update res/version.json itself. Contributors following that documented workflow will edit the generated artifact and have their PR rejected, so the source-of-truth migration needs to update the contributor instructions at the same time. .agents/skills/mas-skills/SKILL.mdL55-L55

Useful? React with 👍 / 👎.

@ClozyA ClozyA closed this Sep 9, 2026
@ClozyA
ClozyA deleted the codex/sync-github-from-dev branch September 10, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant